/**
 * Copyright 2010 The Regents of the University of California
 *
 *  All Rights Reserved
 */
/**
 * File: fault-detect.h
 *
 * This file defines the functionality for liveness detection for fat tree of K = 4
 * Modify the keepalive_ds_init to scale
 */

#ifndef __FAULT_DETECT_H__
#define __FAULT_DETECT_H__

// include files
#include <inttypes.h>
#include "flow.h"
#include "packets.h"
#include "dcswitch.h"

#include "openflow/openflow.h"

#define KEEPALIVE_FREQUENCY_USECS 300000//1000000//300000
#define KEEPALIVE_ERROR_DETECT_FREQUENCY_USECS 20000
#define KEEPALIVE_UP_DETECT_BUFFER 600000
#define MULTICAST_STATE_STALE_LIMIT 30
#define KEEPALIVE_ERROR_DETECTION_BUFFER 2
#define UP 1
#define DOWN 0

//////////////////////////////////////////////////////
// public variables
//////////////////////////////////////////////////////

extern uint8_t keepalive_neighbors[MAX_NUMBER_OF_SWITCHES][ETH_ADDR_LEN];
extern uint8_t eth_hosts[NUM_HOSTS][ETH_ADDR_LEN];
extern uint32_t nw_hosts[NUM_HOSTS];

extern int keepalive_matrix[MAX_NUMBER_OF_SWITCHES][MAX_NUMBER_OF_SWITCHES];
extern struct timeval  mod_time[MAX_NUMBER_OF_SWITCHES][MAX_NUMBER_OF_SWITCHES];

void convert_uint64_to_nmacl(uint64_t hmacl, uint8_t *nmacl);
void keepalive_init();

#endif

